package com.xf.lastmall.moudle.enums;

import lombok.Getter;

/**
 * Created by wangzhaoqian5 on 2018/6/6.
 */
@Getter
public enum OrderPayStatus {
    WAIT_BUY("1", "待支付"),
    PAY_SUCCESS("2", "支付成功"),
    ORDER_CLOSE("3", "交易超时关闭"),
    ORDER_CANCEL("4", "取消 交易关闭"),
    ORDER_COMPLETE("5", "交易完成"),
    //多件购买订单 全部退款  最终状态
    ORDER_FINAL_CLOSE("6", "交易最终关闭"),
    ORDER_SIGNED("7", "已签收，订单完成"),
    ORDER_SHIPPING("8", "已发货");

    private final String value;

    private final String text;

    OrderPayStatus(String value, String text) {
        this.value = value;
        this.text = text;
    }

    public static OrderPayStatus fromValue(String value) {
        for (OrderPayStatus action : OrderPayStatus.values()) {
            if (action.getValue().equals(value)) {
                return action;
            }
        }
        return null;
    }

    public static OrderPayStatus fromText(String text) {
        for (OrderPayStatus action : OrderPayStatus.values()) {
            if (action.getText().equals(text)) {
                return action;
            }
        }
        return null;
    }
}
